# coding=utf-8
import os
import configparser as cparser
# 指定db_config地址
base_dir = str(os.path.dirname(os.path.dirname(__file__)))
base_dir = base_dir.replace('\\', '/')
file_path = base_dir + "/db_config.ini"
cf = cparser.ConfigParser()
cf.read(file_path)
# print(cf.read(file_path))
class linkMySql:
	def link_db(self,mysqlconf):
		db_key = ['dev','host','port','db_name','user','password']
		# print(cf.get(mysqlconf,"db_name"))
		db_info = {kk:cf.get(mysqlconf,kk) for kk in db_key}
		# for kk in db_key:
		# 	print(kk)
		# print({kk for kk in db_key})
		return db_info

if __name__ == "__main__":
	ll = linkMySql()
	print (ll.link_db("local_mysql"))